#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>


int main()
{
	int i = 0;
	for (i = 10000; i < 99999;i++)
	{
		int a = i / 10000;
		int b = i - a*10000;
		int c = i / 1000;
		int d = i - c * 1000;
		int e = i / 100;
		int f = i % 100;
		int g = i % 10;
		int h = (i - g) / 10;
		if (i == a * b + c * d + e * f + g * h)
			printf("%d\n", i);
	}
	return 0;
}